import React from 'react'
import { connect } from 'react-redux';
import { Table, Tag, Space ,Divider} from 'antd';
import styles from './index.less'
class FsmMessagePage extends React.Component{
    constructor(props){
        super(props)
        this.state = {
            data:[]
        }
    }
    componentDidMount(){
        this.props.getAllFsmDatas()
        setTimeout(()=>{
            console.log(this.props.allFsmDatas)
            this.setState({data:this.props.allFsmDatas})
        },1000)
    }
    render(){
        const columns = [
            {
              title: '测量数据ID',
              dataIndex: 'dataId',
              key: 'dataId',
              render: text => <a>{text}</a>,
            },
            {
              title: '测量电流',
              dataIndex: 'measuringCurrent',
              key: 'measuringCurrent',
            },
            {
              title: '太阳能电压',
              dataIndex: 'solarV',
              key: 'solarV',
            },
            {
                title: '测前容器电压',
                dataIndex: 'capBefV',
                key: 'capBefV',
            },
            {
                title: '测后容器电压',
                dataIndex: 'capAftV',
                key: 'capAftV',
            },
            {
                title: '蓄电池电压',
                dataIndex: 'batteryV',
                key: 'batteryV',
            },
            {
                title: '管道温度',
                dataIndex: 'pipeT',
                key: 'pipeT',
            },
            {
                title: '参考版温度',
                dataIndex: 'plateT',
                key: 'plateT',
            },
            {
                title: '测量时间',
                dataIndex: 'measureDate',
                key: 'measureDate',
            },
            // {
            //   title: 'Action',
            //   key: 'action',
            //   render: (text, record) => (
            //     <Space size="middle">
            //       <a>Invite {record.name}</a>
            //       <a>Delete</a>
            //     </Space>
            //   ),
            // },
          ];
          
          const data = this.state.data
        return (<>
            <Divider>FSM设备数据展示</Divider>
            <Table columns={columns} dataSource={data} />

        </>)
    }
}
const mapStateToProps= (state)=>({
    allFsmDatas: state.equipmentPage.allFsmDatas,
    utDatas: state.equipmentPage.utDatas,
})
const mapDispatchToProps = (dispatch)=>({
    getAllFsmDatas:dispatch.equipmentPage.getAllFsmDatas,
    getAllUtDatas:dispatch.equipmentPage.getAllUtDatas
})
export default connect(mapStateToProps,mapDispatchToProps)(FsmMessagePage)